//
//  QJMineOrderFooterThree.m
//  QuanJieShopProject
//
//  Created by 刘中义 on 2018/3/2.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "QJMineOrderFooterFourth.h"

@implementation QJMineOrderFooterFourth
-(void)awakeFromNib{
    
    [super awakeFromNib];
   
    // 删除订单
    self.delBtn.layer.borderWidth = 1;
    self.delBtn.layer.borderColor = YFColor_Red.CGColor;
    [self.delBtn setTitleColor:YFColor_Red forState:UIControlStateNormal];
   
}



- (IBAction)delAction:(UIButton *)sender {
    
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    
    [dict setObject:self.orderId forKey:@"order_id"];
    
    [WWNetRequest fetchDeleteOrderWithParameters:dict success:^(id response) {
        
         [MBPHUD showAlertWithTitle:@"操作成功"];
        
        
    } failure:^(NSDictionary *error) {
        
        [MBPHUD showAlertWithTitle:@"操作失败"];
        
        
    }];
    
}


- (void)footerUpdateModel:(MineOrderModel *)model{
    if (model) {
        model.order_id = self.orderId;
        NSInteger amount = 0;
        for (MineOrderDetailModel *detailModel in model.detailArr) {
            NSInteger num = [detailModel.amount integerValue];
            amount = amount + num;
        }
        
        self.shopNumberLabel.text = [NSString stringWithFormat:@"共%ld件商品,合计",(long)amount];
        self.shopTotalPriceLabel.text = [NSString stringWithFormat:@"￥%@",model.total_amount];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
